//
//  AFTESTClient.m
//  TestProject
//
//  Created by 杨小平 on 14-8-27.
//  Copyright (c) 2014年 yangxiaoping. All rights reserved.
//

#import "AFTESTClient.h"

#define kAFUrl @"http://112.124.104.241/api"

@implementation AFTESTClient

+ (AFTESTClient *)sharedClient {
    
    static AFTESTClient *_sharedClient = nil;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedClient = [[AFTESTClient alloc] initWithBaseURL:[NSURL URLWithString:kAFUrl]];
    });
    
    return _sharedClient;
}

- (id)initWithBaseURL:(NSURL *)url {
    self = [super initWithBaseURL:url];
    if (!self) {
        return nil;
    }
    
    [self registerHTTPOperationClass:[AFJSONRequestOperation class]];
    // Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
	[self setDefaultHeader:@"Accept" value:@"application/json"];
    
    return self;
}

@end
